export function persistedState (context) {

  // 初始化回显数据
  const global = JSON.parse(localStorage.getItem('global') || '{}')
  context.store.$patch(global)

  // 订阅每次state的变化
  context.store.$subscribe((_mutation, state) => {
    localStorage.setItem('global', JSON.stringify(state))
  }, {
    detached: true
  })
  
}